package api

import (
	"net/http"
	"pd/modules/allowed_requrl"
	"pd/utils"

	"github.com/gin-gonic/gin"
)

func (h *Handler) createAllowed_requrl(c *gin.Context) {
	ins := allowed_requrl.NewAllowed_requrl()
	if err := c.ShouldBindJSON(ins); err != nil {
		utils.RequestParamsErr.Msg = err.Error()
		c.JSON(http.StatusOK, utils.RequestParamsErr)
		return
	}

	ins, err := h.svc.CreateAllowed_requrl(c.Request.Context(), ins)
	if err != nil {
		utils.InnerParamsErr.Msg = err.Error()
		c.JSON(http.StatusOK, utils.InnerParamsErr)
		return
	}
	// 成功,则将对象实例返回给HTTP API
	utils.RequestSuccess.Msg = "insert success"
	c.JSON(http.StatusOK, utils.RequestSuccess)

}
